package com.ljy.tkuser.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component                      //项目启动spring加载之后执行一个初始化方法
public class ConstantPropertiesUtils implements InitializingBean {
    //读取配置文件中的内容
    @Value("${aliyun.oss.file.endpoint}")
    private String endPoint;

    @Value("${aliyun.oss.file.keyid}")
    private String keyId;

    @Value("${aliyun.oss.file.keysecret}")
    private String keySecret;

    @Value("${aliyun.oss.file.bucketname}")
    private String bucketName;

    public static String ENDPOINT;
    public static String KEYID;
    public static String KEYSECRET;
    public static String BUCKETNAME;
    @Override
    public void afterPropertiesSet() throws Exception {
            ENDPOINT=endPoint;
            KEYID=keyId;
            KEYSECRET=keySecret;
            BUCKETNAME=bucketName;
    }
}
